package ReflectStudy.Exa12.dymProxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class Agency implements InvocationHandler {

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println(proxy.getClass().getCanonicalName());
        //System.out.println(proxy.getClass().getDeclaredField("sell"));
        System.out.println(method.getName());
        if(method.getName().equals("sell")){
            System.out.println("代理人员在卖房子");
        }
        // 用来处理代理类
        else if(method.getName().equals("sayHello"))
            System.out.println("代理人员像你打招呼");
        return null;
    }

}
